import {
  MDViewEngine,
  ViewController,
  IListViewState,
  IListViewEvent,
  IListController,
} from '@ibiz-template/runtime';
import { IAppDEListView } from '@ibiz/model-core';

export class ListViewEngine extends MDViewEngine {
  protected declare view: ViewController<
    IAppDEListView,
    IListViewState,
    IListViewEvent
  >;

  get list(): IListController {
    return this.view.getController('list') as IListController;
  }

  async onMounted(): Promise<void> {
    await super.onMounted();
    const { model } = this.view;
    this.list.state.mdctrlActiveMode = model.mdctrlActiveMode!;
  }
}
